import Ember from 'ember';
import config from 'game-front/config/environment';
import RSVP from 'rsvp';

export default Ember.Route.extend({
  model(params) {
    return RSVP.hash({
      userInfo: this.modelFor("application"),
      allprize: Ember.$.getJSON(config.apiBase + "prizes", {gameZoneProductId: params.gameZoneProductId})
    });
  },
	share:Ember.inject.service(),
	afterModel() {
		var share = this.get("share");
		var link = window.location.origin + config.baseURL + "allprize";
		var userId = sessionStorage.getItem("userId");
		var shareLink = {
			title: '90秒夺宝', // 分享标题
			desc: '奖品列表',
			link: link+ "#public=true", // 分享链接
			imgUrl: 'http://game.inkanke.com/yydb/assets/images/banner-62c08e1120ab2db597edb26e069052c5.png', // 分享图标
			success: function () {
				share.reward(userId);
			},
			cancel: function () {
				// 用户取消分享后执行的回调函数
			}
		};
		share.config(shareLink);
	}
});
